Integrating Yandex Mediation

Warning

Be sure to update to the latest adapter versions (Yandex Mobile Mediation and adapters for third-party mediation networks). Otherwise, errors from improper adapter integration might occur, preventing the ad from being served.

Mobile mediation is a platform that automatically selects ads from a variety of ad networks using ML algorithms, which helps you maximize your revenue. All settings are preconfigured, so you can start using it immediately without having to set up each network individually.

If you've been using the Mobile Ads SDK with a single Yandex network, migrating to Yandex Mediation requires no code changes. You only need to preset the sections of third-party advertising networks' web interfaces.

Mobile Ads Unity is a plugin for the Unity3d gaming platform, which includes support for the Yandex Mobile Ads SDK.

Prerequisites

To prepare your app, follow the steps described in the next sections.

App requirements

  • To use this SDK, your app's Target API Level must be set to 31 or above.
  • To load any type of ad, iOS version 13 or higher is required.
  • Use Xcode 15 or higher.

Set up the app in your Yandex Advertising Network account

Here's how to register your app in the Yandex Advertising Network:

  1. Log in or register your account in the Yandex Advertising Network.
  2. Register your app in the Yandex Advertising Network.

Integration

Warning

yandex-ads-unity-plugin only runs in Android and iOS environments. Currently, ads can't be loaded and displayed in the Unity editor.

There are two integration methods:

  • Single build (recommended): All available adapters are connected automatically.
  • Connecting individual adapters: Install the Yandex SDK with the lite package and connect specific adapters separately using the appropriate packages.

You can connect all available adapters automatically using the common yandex-mobileads-mediation package.

  1. Set up mediation in the Partner interface.

  2. Download the yandex-ads-unity-plugin directory and add the package yandex-mobileads-mediation-7.7.0.unitypackage. You will also be prompted to install the Google resolver. If you've already added the Google resolver to your project, uncheck the box.

    How to add a package

    Select the required plugin (Assets → Import Package → Custom Package) and click Import.

  3. Use the Google resolver to install dependencies: enable auto-resolve or select the menu item Assets → External Dependency Manager → Android Resolver → Resolve.

  4. To test the Mobile Ads Unity plugin, use one of the demo scripts in the samples directory of the yandex-ads-unity-plugin repository. Copy the script to the project directory and add it as a Component to the main camera.

  5. Additional settings for the Google AdMob (ex. AdMob) network

    • For Android, create the main AndroidManifest.xml file via File → Build Settings → Android → Player Settings → Publishing Settings → Custom Main Manifest (check the box).

      Add your App ID to the created AndroidManifest.xml application file using the <meta-data> tag named com.google.android.gms.ads.APPLICATION_ID.

      <manifest>
          <application>
      <!--...-->
              <meta-data
                  android:name="com.google.android.gms.ads.APPLICATION_ID"
                  android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
      <!--...-->
          </application>
      </manifest>
      
    • In your generated Xcode project for iOS, add the key GADApplicationIdentifier with your app ID to the Info.plist file.

      <key>GADApplicationIdentifier</key>
      <string>ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy</string>
      

    Learn more about where you can find the Google App ID

To connect individual adapters, add a package with a supported yandex-mobileads-lite-x.x.x.unitypackage version and and follow the specific instructions for each adapter to enable them:

  1. Set up mediation in the Partner interface.

  2. Download the yandex-ads-unity-plugin directory and add the package yandex-mobileads-lite-7.7.0.unitypackage. You will also be prompted to install the Google resolver. If you've already added the Google resolver to your project, uncheck the box.

    How to add a package

    Select the required plugin (Assets → Import Package → Custom Package) and click Import.

  3. Use the Google resolver to install dependencies: enable auto-resolve or select the menu item Assets → External Dependency Manager → Android Resolver → Resolve.

  4. To test the Mobile Ads Unity plugin, use one of the demo scripts in the samples directory of the yandex-ads-unity-plugin repository. Copy the script to the project directory and add it as a Component to the main camera.

  5. Connect the required adapters separately using the appropriate packages.